package com.example.entity;

import java.io.Serializable;

@SuppressWarnings("serial")
public class Bookmark implements Item, Comparable<Bookmark>, Serializable {
	private String url;
	private String title;
	private String path;
	
	public Bookmark() {}
	public Bookmark(String path) {
		this.path = path;
	}
	
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getPath() {
		return path;
	}
	public void setPath(String path) {
		this.path = path;
	}
	
	@Override
	public String toString() {
		return "[" + getTitle() + "] " + getUrl();
	}
	
	@Override
	public int compareTo(Bookmark another) {
		return this.path.compareTo(another.getPath()) * -1;
	}
	
	@Override
	public boolean equals(Object o) {
		if (o == null)
			return false;
		
		Bookmark bookmark = (Bookmark) o; 
		return this.path.equals(bookmark.getPath());
	}
	@Override
	public String getKey() {
		return this.path;
	}
}
